<script type="text/javascript">
(() => {
  const registerServiceWorker = () => {
    if (!navigator.serviceWorker) {
      return;
    }

    navigator.serviceWorker
      .register("{{ "/sw.js" | relative_url }}")
      .then(registration => {
        console.log("Service Worker: registered");
      })
      .catch(err => {
        console.log("Service Worker: registration failed ", err);
      });
  };

  registerServiceWorker();
})();
</script>
